﻿#ifndef DETECTOR_H
#define DETECTOR_H

#include <QThread>
#include <yolov8.h>
#include <QImage>

class detector : public QThread
{
    Q_OBJECT
public:
    explicit detector(QObject *parent = nullptr);
    ~detector();


protected:
    void run() override;
    void proprecessing_video();

signals:
    void send_init_info(QString init_info);
    void send_detect_info(QString detect_info);
    void send_video_info(QString video_info);
    void send_display_info(QImage image);
    void send_comboBox_info(QString comboBox_info);
    void send_ready(bool image);



public slots:
    void recv_videofile(QString filename);
    void recv_comboBox_arg(const QString arg1);


private:
    cv::VideoCapture *capture;
    std::vector<cv::Rect> bboxes;

    YOLOV8 *yolov8;
    cv::Mat frame;
    cv::Mat detect_image;
    QString videoName, onnxFile;
    bool m_init = false;
    bool m_is_start = false;

};

#endif // DETECTOR_H
